<template>
	<view class="all">
		<view class="card">
			<view class="tit">
				提现金额
			</view>
			<view class="center flex">
				<text>￥</text>
				<input type="number" v-model="money" />
			</view>
		</view>
		<view class="lists">
			<view class="list flex">
				<view class="left">
					联系人
				</view>
				<input class="right" type="text" placeholder="请输入姓名" v-model="n_name" />
			</view>
			<view class="solid">

			</view>
			<view class="list flex">
				<view class="left">
					联系电话
				</view>
				<input class="right" type="number" maxlength="11" placeholder="请输入手机号" v-model="n_phone" />
			</view>
			<view class="solid">

			</view>
		</view>
		<view class="lists">
			<view class="list flex_sp" @click="bank()">
				<view class="left">
					银行卡
				</view>
				<view class="s4 flex">
					<text v-show="name==''">请选择银行卡</text>
					<text v-show="name">{{name}}</text>
					<image style="width: 14px;height: 14px;" src="../../../static/ming/back.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="tixianmingxi" @click="detil()">
			查看提现明细
		</view>
		<view class="last" @click="withdrawal()">
			确定提现
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: "",
				id: "",
				money: "",
				n_name: "",
				n_phone: ""
			};
		},
		onLoad() {

		},
		onShow() {
			const that = this
			uni.$on('upid', function(data) {
				console.log(data.id);
				that.name = data.name
				that.id = data.id
			})
		},
		methods: {
			detil(){
				uni.navigateTo({
					url:'/pages/index/withdetailed/withdetailed'
				})
			},
			//提现
			withdrawal() {
				if (this.n_name && this.n_phone && this.money && this.id) {
					this.postwith()
				} else {
					uni.$u.toast('请填写完整信息')
				}
			},
			//提现
			async postwith() {
				const res = await this.$api("/business/user/withdrawal", 'post', {
					id: this.id,
					price: this.money,
					phone: this.n_phone,
					contacts: this.n_name
				}).then((res) => {
					console.log(res);
					uni.$u.toast(res.data.msg)
				}).catch((err) => {
					console.log(err);
				})
			},
			bank() {
				uni.navigateTo({
					url: '/pages/mine/bank/bank?info=' + 666
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.all {
		padding: 15px;

		.last {
			position: fixed;
			bottom: 20%;
			width: 90%;
			margin: 0 auto;
			padding: 10px 0;
			text-align: center;
			background-color: #FB774B;
			color: #ffffff;
			border-radius: 40px;
			font-size: 16px;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
		}

		.card {
			background: #FB774B;
			border-radius: 10px;
			padding: 10px;

			.tit {
				font-size: 14px;
				font-weight: 400;
				color: #FFFFFF;
				margin: 10px 0;
			}

			.center {
				padding: 10px 0;
				border-bottom: 1px solid #ffffff;

				text {
					margin: 0 5px;
					font-size: 24px;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
				}

				input {
					font-size: 16px;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
				}

				::-webkit-input-placeholder {
					/* WebKit browsers，webkit内核浏览器 */
					color: #fff;
				}

				:-moz-placeholder {
					/* Mozilla Firefox 4 to 18 */
					color: #fff;
				}

				::-moz-placeholder {
					/* Mozilla Firefox 19+ */
					color: #fff;
				}

				:-ms-input-placeholder {
					/* Internet Explorer 10+ */
					color: #ccc;
					font-size: 16px;
				}


			}
		}

		.money {
			font-size: 15px;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #333333;
			margin: 10px 0;
		}

		.tixianmingxi {
			margin: 20px 0;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			font-size: 14px;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			color: #FB774B;
		}

		.lists {
			margin: 10px 0;
			background: #F5F5F5;
			border-radius: 10px;


			.list {
				padding: 0 10px;

				.left {
					padding: 10px;
					width: 20%;
					font-size: 14px;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #333333;
				}

				.s4 {
					font-size: 14px;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #333333;
				}

				.right {
					flex: 1;
					font-size: 14px;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #333333;
				}
			}
		}
	}
</style>